<?php

namespace app\modules\api\controllers;

use Yii;
use app\modules\api\models\Menu;
use yii\data\ActiveDataProvider;
use yii\rest\ActiveController;
use yii\web\NotFoundHttpException;
use yii\web\ServerErrorHttpException;

/**
 * @OA\Tag(
 *   name="Menu",
 *   description="菜单管理",
 * )
 */
class MenuController extends ActiveController
{
    public $modelClass = 'app\modules\api\models\Menu';

    /**
     * @OA\Get(
     *      path="/menu",
     *      summary="菜单",
     *      tags={"Menu"},
     *      @OA\Response(
     *          response=200,
     *          description="操作成功",
     *          @OA\MediaType(
     *              mediaType="application/json",
     *              @OA\Schema(
     *                  @OA\Property(
     *                      property="typeList",
     *                      type="array",
     *                      @OA\Items(
     *                          @OA\Property(property="label", type="string", example="自己和下属", description="数据授权类型"),
     *                          @OA\Property(property="value", type="integer", example=1, description="值"),
     *                      ),
     *                  ),
     *                  @OA\Property(
     *                      property="authList",
     *                      type="array",
     *                      @OA\Items(
     *                          @OA\Property(property="label", type="string", example="读写", description="字段授权类型"),
     *                          @OA\Property(property="value", type="integer", example=1, description="值"),
     *                      ),
     *                  ),
     *                  @OA\Property(
     *                      property="menu",
     *                      type="array",
     *                      @OA\Items(
     *                          type="object",
     *                          @OA\Property(property="id", type="integer", example=1, description="菜单ID"),
     *                          @OA\Property(property="pid", type="integer", example=0, description="上级ID"),
     *                          @OA\Property(property="label", type="string", example="客户管理", description="菜单名称"),
     *                          @OA\Property(property="level", type="integer", example=1, description="层级"),
     *                          @OA\Property(property="status", type="integer", example=1, description="状态（ 1：启用、0：禁用 ）"),
     *                          @OA\Property(property="type", type="string", example="目录", description="类型"),
     *                          @OA\Property(property="target", type="string", example="打开方式", description="类型"),
     *                          @OA\Property(property="route", type="string", example="user/create", description="路由地址"),
     *                          @OA\Property(
     *                              property="children",
     *                              type="array",
     *                              @OA\Items(
     *                                  type="object",
     *                                  @OA\Property(property="id", type="integer", example=1, description="菜单ID"),
     *                                  @OA\Property(property="pid", type="integer", example=0, description="上级ID"),
     *                                  @OA\Property(property="label", type="string", example="客户管理", description="菜单名称"),
     *                                  @OA\Property(property="level", type="integer", example=1, description="层级"),
     *                                  @OA\Property(property="status", type="integer", example=1, description="状态（ 1：启用、0：禁用 ）"),
     *                                  @OA\Property(property="type", type="string", example="目录", description="类型"),
     *                                  @OA\Property(property="target", type="string", example="打开方式", description="类型"),
     *                                  @OA\Property(property="route", type="string", example="user/create", description="路由地址"),
     *                                  @OA\Property(
     *                                      property="children",
     *                                      type="array",
     *                                      @OA\Items(
     *                                          @OA\Property(property="id", type="integer", example=1, description="菜单ID"),
     *                                          @OA\Property(property="pid", type="integer", example=0, description="上级ID"),
     *                                          @OA\Property(property="label", type="string", example="客户管理", description="菜单名称"),
     *                                          @OA\Property(property="level", type="integer", example=1, description="层级"),
     *                                          @OA\Property(property="status", type="integer", example=1, description="状态（ 1：启用、0：禁用 ）"),
     *                                          @OA\Property(property="type", type="string", example="目录", description="类型"),
     *                                          @OA\Property(property="target", type="string", example="打开方式", description="类型"),
     *                                          @OA\Property(property="route", type="string", example="user/create", description="路由地址"),
     *                                          @OA\Property(
     *                                             property="children",
     *                                             type="array",
     *                                             @OA\Items()
     *                                          )
     *                                      )
     *                                  )
     *                              )
     *                          )
     *                      )
     *                  )
     *              )
     *          )
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionIndex()
    {
    }

    /**
     * @OA\Post(
     *      path="/menu/create",
     *      tags={"Menu"},
     *      summary="添加菜单",
     *      @OA\RequestBody(
     *          @OA\MediaType(
     *              mediaType="multipart/form-data",
     *              @OA\Schema(
     *                  required={"name", "route", "type", "target"},
     *                  @OA\Property(property="parentId", type="integer", description="父级ID", default="0"),
     *                  @OA\Property(property="name", type="string", description="菜单名称"),
     *                  @OA\Property(property="icon", type="string", description="图标"),
     *                  @OA\Property(property="route", type="string", description="路由地址"),
     *                  @OA\Property(property="type", type="integer", enum={1, 2, 3}, description="类型（ 1：目录、2：菜单、3：按钮 ）"),
     *                  @OA\Property(property="target", type="integer", enum={1, 2, 3}, description="打开方式（ 1：新窗口、2：当前窗口、3：弹窗 ）"),
     *                  @OA\Property(property="remark", type="string", description="备注", default=""),
     *                  @OA\Property(property="sort", type="integer", description="排序值", default="0"),
     *             )
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功"
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionCreate()
    {
    }

    /**
     * @OA\Post(
     *      path="/menu/update",
     *      tags={"Menu"},
     *      summary="编辑菜单",
     *      @OA\Parameter(
     *          name="id",
     *          in="query",
     *          description="菜单ID",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *          ),
     *      ),
     *      @OA\RequestBody(
     *          @OA\MediaType(
     *              mediaType="multipart/form-data",
     *              @OA\Schema(
     *                  required={"name", "route", "type", "target"},
     *                  @OA\Property(property="parentId", type="integer", description="父级ID", default="0"),
     *                  @OA\Property(property="name", type="string", description="菜单名称"),
     *                  @OA\Property(property="icon", type="string", description="图标"),
     *                  @OA\Property(property="route", type="string", description="路由地址"),
     *                  @OA\Property(property="type", type="integer", enum={1, 2, 3}, description="类型（ 1：目录、2：菜单、3：按钮 ）"),
     *                  @OA\Property(property="target", type="integer", enum={1, 2, 3}, description="打开方式（ 1：新窗口、2：当前窗口、3：弹窗 ）"),
     *                  @OA\Property(property="remark", type="string", description="备注", default=""),
     *                  @OA\Property(property="sort", type="integer", description="排序值", default="0"),
     *             )
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功"
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionUpdate()
    {
    }

    /**
     * @OA\POST(
     *      path="/menu/delete",
     *      summary="删除菜单",
     *      tags={"Menu"},
     *      @OA\Parameter(
     *          description="菜单ID",
     *          in="query",
     *          name="id",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *              format="int32"
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功"
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionDelete()
    {
    }

    /**
     * @OA\POST(
     *      path="/menu/disable",
     *      summary="禁用菜单",
     *      tags={"Menu"},
     *      @OA\Parameter(
     *          description="菜单ID",
     *          in="query",
     *          name="id",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *              format="int32"
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功"
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionDisable()
    {
    }

    /**
     * @OA\POST(
     *      path="/menu/enable",
     *      summary="启用菜单",
     *      tags={"Menu"},
     *      @OA\Parameter(
     *          description="菜单ID",
     *          in="query",
     *          name="id",
     *          required=true,
     *          @OA\Schema(
     *              type="integer",
     *              format="int32"
     *          )
     *      ),
     *      @OA\Response(
     *          response=200,
     *          description="操作成功"
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionEnable()
    {
    }

    /**
     * @OA\Get(
     *      path="/menu/get-param",
     *      summary="菜单下拉列表数据",
     *      tags={"Menu"},
     *      @OA\Response(
     *          response=200,
     *          description="操作成功",
     *          @OA\MediaType(
     *              mediaType="application/json",
     *              @OA\Schema(
     *                  @OA\Property(
     *                      type="array",
     *                      @OA\Items(
     *                          @OA\Property(property="label", type="string", example="客户管理", description="菜单名称"),
     *                          @OA\Property(property="value", type="integer", example=1, description="菜单ID"),
     *                      ),
     *                  ),
     *                  example={"label":"客户管理", "value": 1}
     *              )
     *          )
     *      ),
     *      security={{
     *          "ApiKeyAuth":{}
     *      }}
     * )
     */
    public function actionGetParam()
    {
    }
}
